<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Title</title>
</head>
<body>
<button onclick="Click()">这是一个弹窗</button>
</body>
<script type="text/javascript">
  function Click() {
    let name = prompt("请输入姓名：");
    let parent = document.querySelector("body");
    let child = document.createElement("div");
    child.innerHTML = name;
    parent.appendChild(child)
  }
</script>
</html>